<% unless @user.new_record? %>
    <script>
        window.user_id = <%= @user.id %>
    </script>
<% end %>
<%= simple_form_for([:admin, @user], html: {class: 'form-horizontal form-show',id: 'user_form' }) do |f| %>
<%= f.error_notification %>
    <div class="row">
      <div class="col-xs-8">
        <%= f.input :name, autofocus: true %>
        <%= f.input :email, required: true %>
        <%= f.input :phone %>
        <%= f.input :password, input_html: {autocomplete: 'off'}, placeholder: '默认密码为手机号码' %>
        <%= f.association :organization, include_blank: false %>
        <%= f.input :remark, as: :text %>
      </div>

        <div class="col-xs-4">
          <div class="base-border" style="margin-top: 0px;">
            <label class="base-border-after">配置角色</label>
            <ul id="roles_tree" class="ztree"></ul>
          </div>
          <div id="roles_div" class="hidden"></div>
        </div>
    </div>

<div class="clearfix form-actions">
  <div class="col-md-offset-3 col-md-9">
    <%= f.button :submit, class: 'btn btn-primary' %>
  </div>
</div>
<% end %>

<%= javascript_include_tag 'users/form_roles' %>